#include <stdio.h>
#include <assert.h>

int get_all_one(int x){
    // !~x
    return !((x & ~0x0) - ~0x0);
}

int get_all_zero(int x){
    // !x
    return !((~x & ~0x0) - ~0x0);
}

int get_low_one(int x){
    // !~(x | ~0xFF)
    return !((x & 0xFF) - 0xFF);
}

int get_high_one(int x){
    int shift_val = (sizeof(int) - 1) << 3;
    // !((x >> shift_val) & 0xFF)
    return !(((x >> shift_val) & 0xFF) - 0xFF);
}


int main(){

    assert(!get_all_one(0x12345678));
    assert(get_all_one(~0));
    assert(!get_all_zero(0x12345678));
    assert(get_all_zero(0));
    assert(!get_low_one(0x12345678));
    assert(get_low_one(0x123456FF));
    assert(!get_high_one(0x12345678));
    assert(get_high_one(0xFF345678));

    return 0;
}
